// src/api/rawMaterialApi.js
import http from '../util/request.js';

export default {
    list: (params = {}) => http({
        url: '/api/raw_material/list',
        method: 'get',
        params,
    }),
    add: (obj) => http({
        url: '/api/raw_material',   // 去掉 /add
        method: 'post',             // POST
        data: obj,
        headers: { 'Content-Type': 'application/json' },
    }),
    edit: (id, obj) => http({
        url: `/api/raw_material/${id}`,  // 使用 /{id}
        method: 'put',                    // PUT
        data: obj,
        headers: { 'Content-Type': 'application/json' },
    }),
    del: (id) => http({
        url: `/api/raw_material/${id}`,  // 使用 /{id}
        method: 'delete',                // DELETE
    }),
};
